package com.sayice.coursetable.logic.utils;

/**
 * 音乐工具类
 */
public abstract class MusicUtils {
    /**
     * 乐器
     */
    private static final String[] midis = {"piano1", "piano2"};

    /**
     * 上一个乐器号
     */
    public static int lastMidiNum(int midiNum) {
        if (midiNum == 0) {
            return midis.length - 1;
        }
        return midiNum - 1;
    }

    /**
     * 下一个乐器号
     */
    public static int nextMidiNum(int midiNum) {
        if (midiNum == midis.length - 1) {
            return 0;
        }
        return midiNum + 1;
    }

    /**
     * 获取乐器名
     *
     * @param midiNum 乐器号
     */
    public static String midi(int midiNum) {
        return midis[midiNum];
    }

    /**
     * 获取音乐名
     *
     * @return 返回音乐名数组
     */
    public static String[] musics() {
        return new String[]{
                "c-", "d-", "e-", "f-", "g-", "a-", "b-",
                "c-1", "d-1", "e-1", "f-1", "g-1", "a-1", "b-1",
                "c-2", "d-2", "e-2", "f-2", "g-2", "a-2", "b-2",
                "c3", "d3", "e3", "f3", "g3", "a3", "b3"
        };
    }
}
